foreach(itk_component ${ITK_REQUIRED_COMPONENTS_BY_MODULE})
  if(NOT itk_component MATCHES "^ITK")
    set(itk_component "ITK${itk_component}")
  endif()
  list(APPEND _itk_required_components_by_module ${itk_component})
endforeach()

find_package(ITK COMPONENTS ${_itk_required_components_by_module} REQUIRED)

foreach(itk_component ${_itk_required_components_by_module})
  if(${itk_component}_LIBRARIES)
    list(APPEND ALL_LIBRARIES ${${itk_component}_LIBRARIES})
  else()
    list(APPEND ALL_LIBRARIES ${itk_component})
  endif()
endforeach()
